//Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.Text;

namespace Eas.WebCrawler.PlugIns.UrlProcessedHandlers {
    /// <summary>Handles <see cref="Eas.WebCrawler.Interfaces.WebCrawlerEvents.UrlProcessed"/> events fired by firing its own events.</summary>
    public class EventFiringUrlProcessedHandler : Eas.WebCrawler.PlugIns.UrlProcessedHandlers.UrlProcessedHandler{

        /// <summary>Fired when the UrlProcessed event occurs.</summary>
        public event System.EventHandler<Eas.WebCrawler.Interfaces.UrlCompletedEventArgs> OnUrlProcessed;

        /// <summary>Fires when the UrlProcessed event.</summary>
        private void Fire_UrlProcessed(Eas.WebCrawler.Interfaces.UrlCompletedEventArgs argument) {
            if (OnUrlProcessed != null) {
                OnUrlProcessed(this, argument);
            }
        }

        #region UrlProcessedHandler Members
        /// <summary>Handles the <see cref="Eas.WebCrawler.Interfaces.WebCrawlerEvents.UrlProcessed"/> event fired by the web crawler when registered to do so.</summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="argument">Details of the processed url.</param>
        /// <remarks>This implementation fires its own events in response to the <see cref="Eas.WebCrawler.Interfaces.WebCrawlerEvents.UrlProcessed"/> event.</remarks>
        public void UrlProcessed(object sender, Eas.WebCrawler.Interfaces.UrlCompletedEventArgs argument) {
            Fire_UrlProcessed(argument);
        }

        #endregion
    }
}
